package spring.chatroom.java_chatroom.mapper.plusSql;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import spring.chatroom.java_chatroom.mapper.UserMapper;
import spring.chatroom.java_chatroom.pojo.model.UserInfo;

import java.util.List;

@Component
public class UserSql {
    @Autowired
    UserMapper userMapper;

    //获得名字和userId
    public List<UserInfo> getUsersByIds(List<Integer> list) {
        QueryWrapper<UserInfo> qw1 = new QueryWrapper<>();

        qw1.in("user_id", list).last("order by user_id asc");

        //获得名字和userId
        return userMapper.selectList(qw1);

    }

}
